package net.myjung.spring;

import java.util.ArrayList;
import java.util.List;

import net.myjung.model.BaseObject;
import net.myjung.model.annotation.MdlAttribute;
import net.myjung.model.annotation.MdlClass;
import net.myjung.model.annotation.MdlElement;
import net.myjung.model.annotation.MdlField;

@MdlClass(name = "Property")
@SuppressWarnings("serial")
public class SprProperty extends BaseObject {
	@MdlField(type = "net.myjung.spring.SprBean")
	private SprBean _parent;
	@MdlAttribute(type = "string")
	private String name;
	@MdlAttribute(type = "string")
	private String value;
	@MdlAttribute(type = "string")
	private String ref;
	@MdlElement(type = "net.myjung.spring.List")
	private SprList list;
	@MdlElement(singular = "prop", type = "net.myjung.spring.Prop")
	private List<SprProp> props;
	@MdlElement(type = "net.myjung.spring.Map")
	private SprMap map;

	public SprBean get_parent() {
		return _parent;
	}
	public void set_parent(SprBean _parent) {
		this._parent = _parent;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getValue() {
		return value;
	}
	public void setValue(String value) {
		this.value = value;
	}
	public String getRef() {
		return ref;
	}
	public void setRef(String ref) {
		this.ref = ref;
	}
	public SprList getList() {
		return list;
	}
	public void setList(SprList list) {
		this.list = list;
	}
	public List<SprProp> getProps() {
		return props;
	}
	public void setProps(List<SprProp> props) {
		this.props = props;
	}
	public void addProp(SprProp prop) {
		if (this.props == null)
			this.props = new ArrayList<SprProp>();
		this.props.add(prop);
	}
	public void removeProp(SprProp prop) {
		if (this.props == null || !this.props.contains(prop))
			return;
		this.props.remove(prop);
	}
	public SprMap getMap() {
		return map;
	}
	public void setMap(SprMap map) {
		this.map = map;
	}
}